﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using ZoneFiveSoftware.Common.Visuals.Fitness;

namespace SportTracksSwimSetPlugin
{
    class Plugin : IPlugin
    {
        public Plugin()
        {
            instance = this;
        }

        public IApplication Application
        {
            set { swimSetApp = value; }
            get { return swimSetApp; }
        }

        public Guid Id
        {
            get { return new Guid("{d41865f7-fcb3-4271-81c1-43f22159c24d}"); }
        }

        public string Name
        {
            get { return "Swim Set Plugin"; }
        }

        public void ReadOptions(XmlDocument xmlDoc, XmlNamespaceManager nsmgr, XmlElement pluginNode)
        {
            Common.SwimSetSettings.Load(pluginNode);
        }

        public string Version
        {
            get { return GetType().Assembly.GetName().Version.ToString(3); }
        }

        public void WriteOptions(XmlDocument xmlDoc, XmlElement pluginNode)
        {
            Common.SwimSetSettings.Save(pluginNode);
        }



        public static IApplication getApplication()
        {        
            return swimSetApp;
        }

        public static Plugin Instance
        {
            get { return Instance; }
        }

        private static Plugin instance = null;
        private static IApplication swimSetApp = null;


        public TimeSpan perHundredPace
        {
            get { return TimeSpan.FromSeconds(perHundredPaceSeconds); }
            set { perHundredPaceSeconds = value.TotalSeconds; }
        }


        private double perHundredPaceSeconds = 0;
        private List<String> swimCategories = null;
    }
}
